﻿using COUP.Core.Enums;

namespace COUP.Core.Networking
{
    public unsafe class ItemDataPacket : Packet
    {
        public ItemDataPacket(Packet Data)
        {
            buffer = Data.Buffer;
        }

        public uint UniqueID
        {
            get
            {
                fixed (byte* ptr = buffer)
                    return (uint)*((uint*)(ptr + 4));
            }
        }

        public uint WarehouseID
        {
            get
            {
                fixed (byte* ptr = buffer)
                    return (uint)*((uint*)(ptr + 4));
            }
        }

        public int Money
        {
            get
            {
                fixed (byte* ptr = buffer)
                    return (int)*((int*)(ptr + 8));
            }
        }

        public int Position
        {
            get
            {
                fixed (byte* ptr = buffer)
                    return (int)*((int*)(ptr + 8));
            }
        }

        public ItemDataType SubType
        {
            get
            {
                fixed (byte* ptr = buffer)
                    return (ItemDataType)(*(ptr + 12));
            }
            set { Byte((byte)value, 12); }
        } 
    }
}
